<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <meta name="csrf-token" content="{{ csrf_token() }}">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">	
        <link rel="shortcut icon" type="image/x-icon" href="{{URL::asset('handan/images/logo-icon.png')}}" />
        <title>周榜</title>
        <link rel="stylesheet" href="{{URL::asset('mobile/css/public.css') }}"/>
        <link rel="stylesheet" href="{{URL::asset('mobile/css/weekrank.css') }}" />
    </head>
<body>
	<div class="img">
		<img src="{{URL::asset('mobile/image/weekrank.png') }}" alt="" />
	</div>
	<section>
		<!--周榜内容-->
	</section>
	  
	<script src="{{URL::asset('public_js/jquery-3.2.1.min.js')}}"></script>
	<script src="{{URL::asset('mobile/js/public.js') }}"></script>
	<script>
		var rankinglist = '{{ url("ranking")}}';
	    var end         = '{{ $end }}';
	    var start       = '{{ $start }}';
		$("document").ready(function(){
			$.ajax({
			     	url:  rankinglist,
			        type: "POST",
			        data:  {start_time:start,end_time:end},
			        async:false,
			        headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
			        success: function (data) {
			            var data = eval("("+data+")");
			            var str = '';
			            for(var i =0 ;i < data.length;i++){
			            	str+='<div class="week_box">';
			            	str+='<div class="photo"><p>';
			            	if(data[i].photo) {
			            		str += '<img src="'+data[i].photo+'" style="border-radius:50%;">';
			            	}else{
			            		str += '<img src="rankinglist/images/user_tx.png" style="border-radius:50%;"></p>';
			            	}
			            	str+='<p>NO'+(i+1)+'</p>';
			            	str+='<p>'+data[i].username+'</p></div>';
			            	str+='<div class="name">';
                                        str+='<p style="font-size: 0.6rem;">'+data[i].week_profit+'点</p>';
                                        str+='<p>本周盈利</p></div>';
                                        str+='<div class="bonus">';
                                        str+='<p>奖金:<span>';
                                        if(data[i].status == 2){
                                           str+='¥'+(data[i].actual_bonus).toFixed(2); 
                                        }else{
                                           str+='¥'+(data[i].bonus).toFixed(2); 
                                        }
                                        
			            	str+='</span></p>';
					str+='<p>';
			            	if(data[i].status == 1){
			                    str += data[i].desc; //未达标时，显示策略数量不符合  或   周盈利点位不符合
			                }else{
                                            if(data[i].allpoint > 0){
                                                str += '已达标';
                                            }else{
                                                str += '已达标(减半)';
                                            }
			                    
			                }
			            	str+='</p></div></div>';
			            }
			            $('section').html(str);
			            //ajax加载完加载css文件
//			            var link = document.createElement('link');
//							link.type = 'text/css';
//							link.rel = 'stylesheet';
//							link.href = "{{URL::asset('mobile/css/weekrank.css') }}";
//							document.getElementsByTagName("head")[0].appendChild(link);
			        },
			        error: function(){}
			    });
		});
	</script>
</body>
</html>
    	
